package com.fxhy.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fxhy.bean.IdentifiInfo;
import com.fxhy.mapper.IdentifiInfoMapper;
import com.fxhy.repository.IdentifiInfoRepository;

@Service
public class IdentifiInfoService {
	@Autowired
	private IdentifiInfoRepository identifiInfoRepository;
	
	@Autowired
	private IdentifiInfoMapper identifiInfoMapper;

	public IdentifiInfo findIdentifiInfoByUserId(Integer userId) {
		return identifiInfoRepository.findByUserId(userId);
	}
	
	public IdentifiInfo findIdentifiInfoById(Integer userId) {
		return identifiInfoRepository.findByIdentifiId(userId);
	}

	public void initInviteCode(Integer userId, String randomString) {
		identifiInfoMapper.initInviteCode(userId,randomString);
	}

	public void saveIdentifyInfo(IdentifiInfo identify) {
		identifiInfoRepository.saveAndFlush(identify);
	}
}
